// aqi.js
var weatherUtil = require('../../utils/weatherApi.js');

var app = getApp();

function refreshData(that) {
  weatherUtil.loadWeatherData((success, data) => {
    that.setData({
      weather: data
    });
    wx.stopPullDownRefresh();
  });
}

Page({
  data: {
    backgroundUrl: 'http://wechat-1252404746.cossh.myqcloud.com/backgroundimg.jpeg',
aqiimg:'http://wechat-1252404746.cossh.myqcloud.com/aqibgi.png',
    weather: {}
  },
  onLoad: function () {
    var that = this;
    refreshData(that);
  },
  onPullDownRefresh: function () {
    console.log("下拉刷新");
    refreshData(this);
  },
  bindViewTap: function () {
  },
  onReady:function(){
    //创建并返回绘图
    var cxt_arc=wx.createCanvasContext("canvasArc");
    cxt_arc.setLineWidth(5);//线条宽度
    cxt_arc.setStrokeStyle('#d2d2d2');//边框颜色
    cxt_arc.setLineCap('round');//端点样式
    cxt_arc.beginPath();//创建路径
    cxt_arc.arc(90,90,86,0,2*Math.PI,false);//创建弧形并设置原点
    cxt_arc.stroke();//边框上色

    cxt_arc.setLineWidth(5);
    cxt_arc.setStrokeStyle('#00EE00');
    cxt_arc.setLineCap('round');//端点样式
    cxt_arc.beginPath();//创建路径
    cxt_arc.arc(90, 90, 86, -Math.PI * 1 / 2, Math.PI * 26/500, false);//创建弧形并设置原点
    cxt_arc.stroke();//边框上色

    cxt_arc.draw();
  }
})